﻿<%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/Master_Page/Master_Popup.Master" CodeBehind="Loading_Popup.aspx.vb" Inherits="I_PORT.Loading_Popup" 
    title="IRPC INTELLIGENT PORT SERVICE" %>
    
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Src="~/Control/Confirm.ascx" TagName="Confirm1" TagPrefix="Confirm" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript" language="javascript">
                    var _source;
    // keep track of the popup div
    var _popup;

    function showConfirm(customerid) {
        this._source = customerid;
        this._popup = $find('ModalPopupExtender3'); 
        this._popup.show();  
    }
       function okClick(){
        //  find the confirm ModalPopup and hide it
       this._popup.hide();

        __doPostBack(this._source.name,'');
        
    }
    
    function cancelClick(){
        //  find the confirm ModalPopup and hide it
        this._popup.hide();
    }
 </script>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
    <table width="100%" border="0" cellpadding="2" cellspacing="0">
        <tr>
             <td style="width:20%;" align="right"><asp:Label ID="Label2" runat="server" SkinID="lbtxt" Text="Shore :"></asp:Label>&nbsp;</td>
             <td align="left">
                 <asp:DropDownList ID="ddlShore" SkinID="ddl" AutoPostBack="true" runat="server">
                 </asp:DropDownList>
             </td>
        </tr>
         <tr>
             <td style="width:20%;" align="right"><asp:Label ID="Label3" runat="server" SkinID="lbtxt" Text="Product :"></asp:Label>&nbsp;</td>
             <td align="left">
                 <asp:DropDownList ID="ddlProduct" SkinID="ddl" runat="server">
                 </asp:DropDownList>
             </td>
        </tr>
         <tr>
             <td style="width:20%;" align="right"><asp:Label ID="Label4" runat="server" SkinID="lbtxt" Text="Line :"></asp:Label>&nbsp;</td>
             <td align="left">
                 <asp:DropDownList ID="ddlLine" SkinID="ddl" runat="server">
                 </asp:DropDownList>
             </td>
        </tr>
        <tr>
           <td colspan="2" align="center" >
                <fieldset style="width:95%"><legend style="color:#848585; font-family:Tahoma;font-size:14px;font-weight:bold;">Detail</legend>
                    <table width="100%" border="0" cellpadding="2" cellspacing="0" >
                                    <tr>
            <td></td>
            <td align="left">
                <asp:GridView ID="gridFacility" runat="server" SkinID="gridblueNoPage" DataKeyNames="Facility_Code,BookingWharf,Wharf,L_D,Before,After,Rate,Unit,Remark,Plus_Tank,Plus_Parcel_Before,Plus_Product_Before,Plus_Parcel_After,Plus_Product_After"
                                   AutoGenerateColumns="False">
                                    <Columns>
                                        <asp:BoundField HeaderText="L/D" />
                                        <asp:BoundField HeaderText="Wharf" DataField="Wharf" />
                                        <asp:BoundField HeaderText="Facility" DataField="Facility" />
                                        <asp:BoundField HeaderText="Before" DataField="RateText" />
                                        <asp:BoundField HeaderText="Rate" DataField="Rate" />
                                        <asp:BoundField HeaderText="After" DataField="After" />
                                        <asp:BoundField HeaderText="Remark" DataField="Remark" />
                                        <asp:TemplateField HeaderText="แก้ไข" ItemStyle-Width="50px">
                                              <ItemTemplate>
                                                <asp:ImageButton ID="imgedit" CommandName="cmdedit" CommandArgument="<%# Container.DataItemIndex %>"  runat="server" ImageUrl="~/Image/edit-24.gif" />
                                           </ItemTemplate>
                                       </asp:TemplateField>
                                        <asp:TemplateField HeaderText="ลบ" ItemStyle-Width="50px" ItemStyle-HorizontalAlign="Center">
                                        <ItemTemplate>
                                          <asp:ImageButton ID="imgdelete" CommandName="cmddelete" CommandArgument="<%# Container.DataItemIndex %>" OnClientClick="showConfirm(this); return false;"  runat="server" ImageUrl="~/Image/cancel-24.gif" />
                                        </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                       </asp:GridView>
                   </td>
                 </tr>
                              <tr>
                                    <td style="width:12%;" align="right"><asp:Label ID="Label6" runat="server" SkinID="lbtxt" Text="Load/Disch :"></asp:Label>&nbsp;</td>
                                    <td align="left">
                                       <asp:DropDownList ID="ddlLD" SkinID="ddl" runat="server">
                                          <asp:ListItem Value="L">Load</asp:ListItem>
                                          <asp:ListItem Value="D">Disch</asp:ListItem>
                                       </asp:DropDownList>
                                     </td>
                                </tr>
                                <tr>
                                    <td style="width:12%;" align="right"><asp:Label ID="Label1" runat="server" SkinID="lbtxt" Text="Wharf :"></asp:Label>&nbsp;</td>
                                    <td align="left">
                                       <asp:DropDownList ID="ddlWharf" SkinID="ddl" runat="server"></asp:DropDownList>
                                     </td>
                                </tr>
                                <tr>
             <td style="width:12%;" align="right"><asp:Label ID="Label12" runat="server" SkinID="lbtxt" Text="Facility :"></asp:Label>&nbsp;</td>
             <td align="left">
                  <asp:TextBox ID="txtFacility" runat="server" Width="200px"></asp:TextBox>
                  <asp:AutoCompleteExtender  runat="server" ID="autoComplete1" BehaviorID="AutoCompleteEx" CompletionInterval="50"
                     TargetControlID="txtFacility" ServicePath="../WebService/AutoComplete_IPORT.asmx" MinimumPrefixLength="2" 
                    ServiceMethod="GetFacility" CompletionListCssClass="autocomplete_completionListElement"
                CompletionListItemCssClass="autocomplete_listItem" 
                CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem" >
                <Animations>
                    <OnShow>
                        <Sequence>
                            <%-- Make the completion list transparent and then show it --%>
                            <OpacityAction Opacity="0" />
                            <HideAction Visible="true" />
                            
                            <%--Cache the original size of the completion list the first time
                                the animation is played and then set it to zero --%>
                            <ScriptAction Script="
                                // Cache the size and setup the initial size
                                var behavior = $find('AutoCompleteEx');
                                if (!behavior._height) {
                                    var target = behavior.get_completionList();
                                    behavior._height = target.offsetHeight - 2;
                                    target.style.height = '0px';
                                }" />
                            
                            <%-- Expand from 0px to the appropriate size while fading in --%>
                            <Parallel Duration=".3">
                                <FadeIn />
                                <Length PropertyKey="height" StartValue="0" EndValueScript="$find('AutoCompleteEx')._height" />
                            </Parallel>
                        </Sequence>
                    </OnShow>
                    <OnHide>
                        <%-- Collapse down to 0px and fade out --%>
                        <Parallel Duration=".3">
                            <FadeOut />
                            <Length PropertyKey="height" StartValueScript="$find('AutoCompleteEx')._height" EndValue="0" />
                        </Parallel>
                    </OnHide>
                </Animations>
                 </asp:AutoCompleteExtender>
             </td>
        </tr>
                <tr>
         <td style="width:12%;" align="right"><asp:Label ID="Label7" runat="server" SkinID="lbtxt" Text="Before :"></asp:Label>&nbsp;</td>
         <td align="left">
             <asp:TextBox ID="txtBefore" runat="server" Width="60px" MaxLength="5"></asp:TextBox>&nbsp;+&nbsp;<asp:TextBox ID="txtTank" runat="server" Width="60px" MaxLength="10" Text="0"></asp:TextBox>&nbsp;<asp:Label ID="Label8" runat="server" SkinID="lbtxt" Text="Tank"></asp:Label>
              <asp:MaskedEditExtender ID="MaskedEditExtender14" runat="server" TargetControlID="txtBefore"
                 Mask="99:99" MaskType="Time" AcceptNegative="Left" Enabled="True">
              </asp:MaskedEditExtender>
         </td>
       </tr>
       <tr>
             <td style="width:12%;" align="right"><asp:Label ID="Label5" runat="server" SkinID="lbtxt" Text="Rate :"></asp:Label>&nbsp;</td>
             <td align="left">
                <asp:TextBox ID="txtRate" runat="server" Width="60px" MaxLength="10" Text="0"></asp:TextBox>&nbsp;
                 <asp:DropDownList ID="ddlUnit" SkinID="ddl" runat="server">
                   <asp:ListItem>M3</asp:ListItem>
                   <asp:ListItem>MT</asp:ListItem>
                 </asp:DropDownList>
             </td>
        </tr>
       <tr>
         <td style="width:12%;" align="right"><asp:Label ID="Label9" runat="server" SkinID="lbtxt" Text="After :"></asp:Label>&nbsp;</td>
         <td align="left">
             <asp:TextBox ID="txtAfter" runat="server" Width="60px" MaxLength="5"></asp:TextBox>
             <asp:MaskedEditExtender ID="MaskedEditExtender1" runat="server" TargetControlID="txtAfter"
                 Mask="99:99" MaskType="Time" AcceptNegative="Left" Enabled="True">
              </asp:MaskedEditExtender>
         </td>
       </tr>
       <tr>
         <td style="width:12%;" align="right"><asp:Label ID="Label10" runat="server" SkinID="lbtxt" Text="Time Parcel :"></asp:Label>&nbsp;</td>
         <td align="left">
             <asp:Label ID="Label16" runat="server" SkinID="lbtxt" Text="Before"></asp:Label>&nbsp;<asp:TextBox ID="txtParcel" runat="server" Width="60px" Text="00:00" MaxLength="5"></asp:TextBox>&nbsp;<asp:Label ID="Label17" runat="server" SkinID="lbtxt" Text="After"></asp:Label>&nbsp;<asp:TextBox ID="txtParcelAfter" Text="00:00" runat="server" Width="60px" MaxLength="5"></asp:TextBox>&nbsp;<asp:Label ID="Label13" runat="server" SkinID="lbtxt" Text="/1 Parcel in Group"></asp:Label>
             <asp:MaskedEditExtender ID="MaskedEditExtender2" runat="server" TargetControlID="txtParcel"
                 Mask="99:99" MaskType="Time" AcceptNegative="Left" Enabled="True">
              </asp:MaskedEditExtender>
              <asp:MaskedEditExtender ID="MaskedEditExtender4" runat="server" TargetControlID="txtParcelAfter"
                 Mask="99:99" MaskType="Time" AcceptNegative="Left" Enabled="True">
              </asp:MaskedEditExtender>
         </td>
       </tr>
       <tr>
         <td style="width:12%;" align="right"><asp:Label ID="Label14" runat="server" SkinID="lbtxt" Text="Time Product :"></asp:Label>&nbsp;</td>
         <td align="left">
             <asp:Label ID="Label18" runat="server" SkinID="lbtxt" Text="Before"></asp:Label>&nbsp;<asp:TextBox ID="txtProduct" runat="server" Text="00:00" Width="60px" MaxLength="5"></asp:TextBox>&nbsp;<asp:Label ID="Label19" runat="server" SkinID="lbtxt" Text="After"></asp:Label>&nbsp;<asp:TextBox ID="txtProductAfter" Text="00:00" runat="server" Width="60px" MaxLength="5"></asp:TextBox>&nbsp;<asp:Label ID="Label15" runat="server" SkinID="lbtxt" Text="/1 Product in Group"></asp:Label>
             <asp:MaskedEditExtender ID="MaskedEditExtender3" runat="server" TargetControlID="txtProduct"
                 Mask="99:99" MaskType="Time" AcceptNegative="Left" Enabled="True">
              </asp:MaskedEditExtender>
              <asp:MaskedEditExtender ID="MaskedEditExtender5" runat="server" TargetControlID="txtProductAfter"
                 Mask="99:99" MaskType="Time" AcceptNegative="Left" Enabled="True">
              </asp:MaskedEditExtender>
         </td>
       </tr>
       <tr>
         <td style="width:20%;" valign="top" align="right"><asp:Label ID="Label11" runat="server" SkinID="lbtxt" Text="Remark :"></asp:Label>&nbsp;</td>
         <td align="left">
             <asp:TextBox ID="txtRemark" runat="server" Width="90%" Height="50px" MaxLength="2000"></asp:TextBox>
         </td>
       </tr>
              <tr>
         <td style="width:12%;" align="right">&nbsp;</td>
         <td align="left">
               <asp:Button ID="btnAdd" runat="server" Text="เพิ่ม ข้อมูล" CssClass="ButtonStyle" />
               <asp:Button ID="btnClear" runat="server" Text="เคลียร์ข้อมูล" CssClass="ButtonStyle" />
         </td>
       </tr>
                    </table>
                </fieldset>
           </td>
        </tr>
       <tr>
         <td style="width:20%;" align="right">&nbsp;</td>
         <td align="right">
               <asp:Button ID="btnSave" runat="server" Text="บันทึก" CssClass="ButtonStyle" />
               <asp:Button ID="btnCancel" runat="server" Text="ยกเลิก" CssClass="ButtonStyle" />&nbsp;
         </td>
       </tr>
     </table>
     <asp:Button ID="BtnTrigger" runat="server" style="display:none;" />
     <asp:ModalPopupExtender ID="ModalPopupExtender3" BehaviorID="ModalPopupExtender3" runat="server" 
                                    OkControlID="ctl00_contentplaceholder1_ConfirmDelete_btnOk" 
                                    OnOkScript="okClick();" 
                                    CancelControlID="ctl00_contentplaceholder1_ConfirmDelete_btnNo"     
                                    OnCancelScript="cancelClick();" 
                                     BackgroundCssClass="Background" DropShadow="false" 
                                      PopupControlID="PanelConfirm" TargetControlID="BtnTrigger" >
        </asp:ModalPopupExtender>
        <asp:Panel ID="PanelConfirm" runat="server" style="display:none;">
       <Confirm:Confirm1 ID="ConfirmDelete" runat="server" ></Confirm:Confirm1>
    </asp:Panel>
     </ContentTemplate>
 </asp:UpdatePanel>
</asp:Content>
